from src.core import log


class __SoF:
    """功能状态"""
    c_compile: bool = False
    fm_nginx: bool = False
    fm_unzip: bool = False
    os_unzip: bool = False
    jdk: bool = False
    java: bool = False
    static: bool = False
    multi_node: bool = False

    def __setattr__(self, name, value):
        translate_dict = {
            'c_compile': 'C编译器',
            'fm_nginx': 'fm_nginx',
            'fm_unzip': 'fm_unzip功能',
            'os_unzip': '系统unzip',
            'jdk': 'JDK',
            'java': 'Java服务托管',
            'static': '前端静态文件托管',
            'multi_node': '多节点模式'
        }
        if name not in ['jdk']:
            log.INFO(f"渔翁功能：{translate_dict[name]}已启用！")
        super().__setattr__(name, value)
        if self.fm_nginx and self.fm_unzip and not self.static:
            self.static = True
        elif self.fm_nginx and self.os_unzip and not self.static:
            self.static = True
        if self.jdk and not self.java:
            self.java = True
    
    
sof = __SoF()

# 版本信息
VERSION = '0.7-dev'

FUNCTIONS = ['multi_node']
FUNCTIONS_BEHAVIOR = ['enable', 'disable']